package tk.deep.domain.biz.odr;

import java.math.BigDecimal;

/**
 * Created by boot on 9/23/15.
 */
public class OrderItem {
    // 商品id
    private Long goodsId;

    // 商价格
    private BigDecimal goodsPrice;

    // 活动id
    private Long activityId;

    // 购买数量
    private int quantity;
    // 购买的单价
    private BigDecimal price;

    /**
     * 实际支付金额
     * 没有参与使用优惠券的情况，此数据为 cnt * price;
     * 使用优惠券的情况，此数据为 cnt * price - 优惠券分摊
     */
    private BigDecimal actualPayment;

    // 优惠金额
    private BigDecimal promotions;


    public Long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }

    public BigDecimal getGoodsPrice() {
        return goodsPrice;
    }

    public void setGoodsPrice(BigDecimal goodsPrice) {
        this.goodsPrice = goodsPrice;
    }

    public Long getActivityId() {
        return activityId;
    }

    public void setActivityId(Long activityId) {
        this.activityId = activityId;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getActualPayment() {
        return actualPayment;
    }

    public void setActualPayment(BigDecimal actualPayment) {
        this.actualPayment = actualPayment;
    }

    public BigDecimal getPromotions() {
        return promotions;
    }

    public void setPromotions(BigDecimal promotions) {
        this.promotions = promotions;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        OrderItem orderItem = (OrderItem) o;

        if (!goodsId.equals(orderItem.goodsId)) return false;
        return price.equals(orderItem.price);

    }

    @Override
    public int hashCode() {
        int result = goodsId.hashCode();
        result = 31 * result + price.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "OrderItem{" +
                "goodsId=" + goodsId +
                ", goodsPrice=" + goodsPrice +
                ", activityId=" + activityId +
                ", quantity=" + quantity +
                ", price=" + price +
                ", actualPayment=" + actualPayment +
                ", promotions=" + promotions +
                '}';
    }

}
